package com.TeacherInfoServer.controller;

import com.TeacherInfoServer.common.Result;
import com.TeacherInfoServer.common.service.StatsService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/s1/stats")
public class StatsController {

    @Autowired
    private StatsService statsService;

    @GetMapping("/teacherStats")
    @Operation(summary = "获取教师各类型统计", description = "根据类型名称统计教师数量")
    public Result<List<Map<String, Object>>> teacherStats(@RequestParam("typename") String typename) {
        return statsService.teacherStats(typename);
    }

    // 统计各教研室的教师数量
    @GetMapping("/departmentStats")
    @Operation(summary = "获取各教研室教师统计", description = "统计各教研室教师数量")
    public Result<List<Map<String, Object>>> departmentStats() {
        return statsService.departmentStats();
    }

    // 统计教师性别比例
    @GetMapping("/genderStats")
    @Operation(summary = "获取教师性别比例", description = "统计教师男女比例")
    public Result<List<Map<String, Object>>> genderStats() {
        return statsService.genderStats();
    }

}
